package com.accp.demo.controller.finance;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.accp.demo.service.finance.IPrepayService;

/**
 * 预付款
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/prepay/")
public class IPrepayController {

	@Autowired
	private IPrepayService prepayService;
	
	/**
	 * 新增
	 * @param map
	 * @return
	 */
	@ResponseBody
	@RequestMapping("saveOrUpdate")
	public Object saveOrUpdate(@RequestBody Map<String, Object> map ){
		//System.out.println(JSON.toJSONString(map));
		System.out.println("我在controller准备新增或者修改了");
		return this.prepayService.saveOrUpdate(map);		
	}
	
	
	
	/**
	 * 分页查询
	 * @param page
	 * @return
	 */
	@ResponseBody
	@RequestMapping("findByPage")
	public Object findByPage(int page){
		System.out.println("我在controller分页查询");
		return this.prepayService.findByPage(page,1);
	}
	
	/**
	 * 生成单号
	 * @param map
	 * @return
	 */
	@ResponseBody
	@RequestMapping("getNewNo")
	public Object getNewNo(@RequestParam Map<String, Object> map){
		return this.prepayService.getNewNo(map);
	}
	
	/**
	 * 删除（修改逻辑状态）
	 * @param map
	 * @return
	 */
	@ResponseBody
	@RequestMapping("updLogicalState")
	public Object updLogicalState(@RequestBody Map<String, Object> map ){
		//System.out.println(JSON.toJSONString(map));
		System.out.println("我在controller准备删除时修改逻辑状态");
		return this.prepayService.updLogicalState(map);	
	}
	
	/**
	 * 审核
	 * @param map
	 * @return
	 */
	@ResponseBody
	@RequestMapping("updExamineAfter")
	public Object updExamineAfter(@RequestBody Map<String, Object> map){
		System.out.println("我在controller准备审核");
		return this.prepayService.updPrepayExamineAfter(map);
	}
	
}
